package com.jsyl.lwbk.common.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.jsyl.lwbk.common.exception.BusinessException;

/**
 * sec Json 工具类
 * @author jh
 * @version 1.0
 * @date 2019/3/8 0008.
 */
public class SecJsonUtil {

    public static <T> T readJsonObject(Object bean, Class<T> clzz) throws BusinessException {
        if(bean == null){
            return null;
        }
        try {
            return JsonUtil.convertObjectToJsonObject(bean,clzz);
        }catch (Exception e){
            throw new BusinessException(e.getMessage());
        }
    }

     /** 对象转json
	 * @param object
	 * @return
             * @throws JsonProcessingException
	 */
    public static String readObjectToJson(Object object) throws BusinessException{
        try {
            return JsonUtil.readObjectToJson(object);
        }catch (Exception e){
            throw new BusinessException(e.getMessage());
        }
    }


}
